/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.upc.galaxy.dao.impl;
import edu.upc.galaxy.dao.*;
import edu.upc.galaxy.entity.Comentario;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.springframework.stereotype.Repository;

/**
 * @author ydb
 */
@Repository
public class ComentarioDaoImpl extends BaseDao {
    

    
    public Integer insertar(Comentario comentario) {
        String insert = "insert into comentario(texto,calificacion) values (?,?)";
        List list = new ArrayList();
        list.add(comentario.getTexto());
        list.add(comentario.getCalificacion());
        return this.insert(insert, list);
    }
    
    public void actualizar(Comentario comentario) {
        String update = "update comentario set texto = ?, calificacion = ? where id = ?";
        List list = new ArrayList();
        list.add(comentario.getTexto());
        list.add(comentario.getCalificacion());
        list.add(comentario.getID());
        this.update(update, list);
    }
    
    public void eliminar(Comentario comentario) {
        String delete = "delete from comentario where id = ?";
        this.delete(delete,comentario.getID());
    }
    
    

}

 
    


